﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;

using Willson.JsbManager.Entity;
using Willson.JsbManager.Idal;
using Willson.JsbManager.Comm;

namespace Willson.JsbManager.Dal
{
    public class DAL_table_xt_company_sb_info : BaseDal<TableXtCompanySbInfoEntity>, ITableXtCompany_sb_info
    {
         #region 对象实例及构造函数

		public static DAL_table_xt_company_sb_info Instance
		{
			get
			{
				return new DAL_table_xt_company_sb_info();
			}
		}
        public DAL_table_xt_company_sb_info()
            : base("table_xt_company_sb_info", "id", string.Empty, true)
		{ }

        #endregion

        /// <summary>
        /// 将DataReader的属性值转化为实体类的属性值，返回实体类
        /// </summary>
        /// <param name="dr">有效的DataReader对象</param>
        /// <returns>实体类对象</returns>
        protected override TableXtCompanySbInfoEntity DataReaderToEntity(IDataReader dataReader)
        {
            TableXtCompanySbInfoEntity entity = new TableXtCompanySbInfoEntity();
            SmartDataReader reader = new SmartDataReader(dataReader);

            entity.Id = reader.GetInt32("id");
            entity.Memo = reader.GetString("memo");
            entity.Company_id = reader.GetInt32("company_id");
            entity.Ht_code = reader.GetString("ht_code");
            entity.User_code = reader.GetString("user_code");
            entity.Remove = reader.GetInt32("remove");
            entity.Sb_size = reader.GetString("sb_size");
            entity.Wp_id = reader.GetInt32("wp_id");

            return entity;
        }

        /// <summary>
        /// 将实体对象的属性值转化为Hashtable对应的键值(用于插入或者更新操作)
        /// (提供了默认的反射机制获取信息，为了提高性能，建议重写该函数)
        /// </summary>
        /// <param name="obj">有效的实体对象</param>
        /// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(TableXtCompanySbInfoEntity obj)
        {
            TableXtCompanySbInfoEntity info = obj as TableXtCompanySbInfoEntity;
            Hashtable hash = new Hashtable();

            hash.Add("id", info.Id);
            hash.Add("memo", info.Memo);
            hash.Add("company_id", info.Company_id);
            hash.Add("ht_code", info.Ht_code);
            hash.Add("user_code", info.User_code);
            hash.Add("remove", info.Remove);
            hash.Add("sb_size", info.Sb_size);
            hash.Add("wp_id", info.Wp_id);

            return hash;
        }
    }
}
